#pragma once

#include "BasicType.h"
#include "Character.h"

namespace LightPlayer{

	class LightAbstractRenderer;
	class CharacterList;
	class Shape;

	class FontInfo{
		 friend class Font;

		const char*			m_FontName;
		array<uint8>		m_NameMemory;
		array<uint16>		m_CodeTable;
		uint8				m_LanguageCode;

		bool				m_alignMem1:1;
		bool				m_alignMem2:1;
		bool				m_flag_small_text:1;
		bool				m_flag_shift_JIS:1;
		bool				m_flag_ANSI:1;
		bool				m_flag_italic:1;
		bool				m_flag_bold:1;
		bool				m_flag_wide_code:1;

	public:

		FontInfo() {init();};
		virtual ~FontInfo() {};
		void init();
		void readFromStream(Stream* stream, const TAG& actual_tag, int glyph_number );
	};

	class Font : public Character {
		uint16					m_CharacterId;
		CharacterList*			m_pCharacterList;
		array<Shape*>			m_Glyphs;
		FontInfo				m_Info;
	public:

		Font();
		virtual ~Font();
		void init();
		void readFromStream(Stream* stream, const TAG& actual_tag, CharacterList* pCharacterList = NULL );

		Shape*					getGlyph(uint32 index) const												{return m_Glyphs[index];}
		int						getGlyphNumber() const														{return m_Glyphs.size();}
		FontInfo&				getEditableFontInfo()														{return m_Info;};
		// character interface
		virtual eCharacterType	getType()	const															{return eFontCharacter;};
		virtual uint16			getCharacterId()	const													{return m_CharacterId;};
				void			setCharacterId(uint16 characterId)											{m_CharacterId = characterId;};
		virtual void			draw(LightAbstractRenderer* pRenderer, SceneObject* pInstance)				{assert(0);};
	};

};